//函数,支持多返回值
package main

import "fmt"

//单返回值
func foo1(a string, b int) int {
	fmt.Println(a, b)
	return 1
}

//多个返回值,匿名
func foo2(a int) (int, string) {
	fmt.Println("foo2-----")
	return a, "abcd"
}

//多个返回值,指定变量名
func foo3() (r1 int, r2 int) {
	fmt.Println("foo3------")
	r1 = 100
	r2 = 200
	return
}

//等同上面,类型相同可缩写
func foo4() (r1, r2 int) {
	fmt.Println("foo4------")
	r1 = 100
	r2 = 200
	return
}

func main() {
	foo1("abc", 123)

	a, b := foo2(1)
	fmt.Println(a, b)

	c, d := foo3()
	fmt.Println(c, d)

	e, f := foo4()
	fmt.Println(e, f)
}
